09. Steps to Create a Fragment

Ordered steps to create a fragment

QUIZ QUESTION::

Match the tasks you need to complete in order to dynamically display a fragment with the order that they should be executed in.

For example, to start a new activity: 1) Create a new Intent that points to the new activity, 2) Add any information you want to that Intent, 3) Start the intent (in this order).

ANSWER CHOICES:



Task description

Step number

Create a new fragment class that inflates a layout

Create a layout that defines the appearance of the fragment

Add the fragment to it's host activity using the FragmentManager and a fragment transaction

Create a new fragment instance in a host activity

SOLUTION:

Task description

Step number

Create a layout that defines the appearance of the fragment

Add the fragment to it's host activity using the FragmentManager and a fragment transaction

Create a new fragment instance in a host activity

Create a new fragment class that inflates a layout